extends ./index.jade

block content
	.rightSide
		.container-fluid
			.row
				form#delivery.form.form-inline
						label 学校
						select#querySchool.form-control.widthFixed
						//- label.marginLeft(for="canteens") 食堂
						//- select#canteens.form-control.widthFixed(name="canteens")
						label.marginLeft 状态
						select#status.widthFixed
							option(value = '-1') 全部
							option(value = '0') 没有创建支付交易
							option(value = '1') 等待买家付款
							option(value = '2') 等待成团
							option(value = '3') 等待卖家发货
							option(value = '4') 等待买家确认收货
							option(value = '5') 买家已签收
							option(value = '6') 用户退款成功，交易自动关闭
							option(value = '7') 用户关闭交易
							option(value = '8') 所有关闭订单
						label.marginLeft 条数
						input#page_size.widthFixed(type='number' value='100')
						label 条
						label.marginLeft 选择时间：
							//- span#date
						input#date_today.datepicker.date.form_datetime.controls.widthFixed(type='text' placeholder='日期' required)
						input#start.datepicker.date.form_datetime.controls.time.widthFixed(type='text' placeholder='请选择开始时间' required)
						label 至
						input#end.datepicker.date.form_datetime.controls.time.widthFixed(type='text' placeholder='请选择结束时间' required)
						button#queryGoods.btn.btn-primary.marginLeft(type='submit') 查询
						#tips.text-danger
			#deliveryInfo.row
				.row
					a#export_goodsSum.btn.btn-primary.btn(href='javascript:;') 导出商品数量表
				.row
					a#export_goodsInfo.btn.btn-primary.btn 导出商品详情表
					label(for='status')
						input(type='checkbox' id='status_check' value='status')
						状态
					label(for='created_time')
						input(type='checkbox' id='created_time' value='created_time')
						创建时间			
				.row
					table#goodsSumTable.table.table-bordered.table-hover
						caption.h4.text-center 商品数量表
						thead
							th 商品
							th 数量
						tbody#goodsSum
				.row.text-right.forcedVerticalCenter
					span 
						|共
						span#goods_count
						|条记录
				.row
					table#goodsInfoTable.table.table-bordered(border="1")
						caption.h4.text-center 商品详情表
						thead
							th 序号
							th 商品
							th 数量
							th 收货人
							th 地址
							th 留言
							th 电话
							th 状态
							th 交易创建时间
							th 接单人
							th 配送状态
						tbody#goodsInfo
						tfoot#send-orders
								tr
										td
												label.orders-cursor.orders-nowrap ALL
														input.orders-cursor#getAll(type="checkbox" onclick="myFun.getAll()")
										td(colspan=1).send-btn
												button#pullOrder.btn.btn-primary(type="button") 发送订单
										td#sendBar(colspan="3")
												div.progress.progress-striped
														div(role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0").progress-bar.progress-bar-success
												span.success-num 0%
										td#sendResult(colspan="6")
				.row.text-right.forcedVerticalCenter
					span 
						|共
						span#total
						|条记录
					#paginator.paginator

	link(rel='stylesheet' href='/css/lib/bootstrap-datetimepicker.css')
	link(rel='stylesheet' href='/css/lib/select2.min.css')
	script#template_school(type='text/dot-tpl')
		|{{~it:value:index}}
		option(value='{{=value.id}}') {{=value.name}}
		|{{~}}

	script#template_canteen(type='text/dot-tpl')
		|{{~it:value:index}}
		option(id='{{=value.id}}') {{=value.name}}
		|{{~}}

	script#template_goodsSum(type='text/dot-tpl')
		|{{~it:value}}
		tr
			td {{=value.item_name}}
			td {{=value.count}}
		|{{~}}

	script#template_goodsInfo(type='text/dot-tpl')
		|{{~it:value:index}}
		|{{for(var item in value.delivers){}}
		|{{?item==0}}
		tr
			td.ordersIndex.orders-nowrap(rowspan='{{=value.delivers.length}}' data-tradeid='{{=value.trade_id}}')
				label.orders-cursor {{=index+1}}
					input.orders-cursor(type="checkbox" )
			td.itemName {{=value.delivers[item].item_name}}
			td.itemCount {{=value.delivers[item].count}}
			td.receiverName {{=value.receiver_name}}
			td.receiverAddress(rowspan='{{=value.delivers.length}}') {{=value.receiver_address}}
			td.message(rowspan='{{=value.delivers.length}}') {{=value.message}}
			td.receiverTel(rowspan='{{=value.delivers.length}}') {{=value.receiver_mobile}}
			td.status(rowspan='{{=value.delivers.length}}') {{=value.status}}
			td.tradeTime(rowspan='{{=value.delivers.length}}') {{=value.created_time}}
			td(rowspan='{{=value.delivers.length}}') {{=value.sender_name}}
			td.sendStatus(rowspan='{{=value.delivers.length}}') {{=value.send_status}}
		|{{??}}
		tr
			td(class='{{=value.trade_id}}') {{=value.delivers[item].item_name}}
			td.moreOrderCount {{=value.delivers[item].count}}
			td {{=value.receiver_name}}
		|{{?}}
		|{{}}}
		|{{~}}
	script#template_progress(type='text/dot-tpl')
			div.progress.progress-striped
				div.progress-bar-info(role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: {{=it}}").progress-bar.progress-bar-success
			span.success-num
	script(src="/js/lib/require.js" data-main="/js/delivery_manage")
